<template>
<div>
  <p>班级名字：<input type="text" v-model="form.name"></p>
  <p>班级说明：<input type="text" v-model="form.content"></p>
  <p>学校<select v-model="form.school">
    <option v-for="i in school">{{i.name}}</option>
  </select></p>
  <button @click="add">添加</button>
</div>
</template>

<script>
export default {
  name: "Aa_class",
  data(){
    return{
      form:{},
      school:[]
    }
  },
  methods:{
    add(){
      this.$axios.post('users/class/',this.form)
        .then(res=>{
          if(res.data.code==200){
            alert('添加成功')
          }
        })
    },
    get_school(){
      this.$axios.get('users/school/')
      .then(res=>{
        this.school = res.data.list
      })
    }
  },
  mounted() {
    this.get_school()
  }
}
</script>

<style scoped>

</style>
